/**
 * Created by chesw on 2017/5/19.
 */
/**
 * Created by chesw on 2017/5/18.
 * describe: 图文样式
 */
var graphicFrame = Vue.extend({
    props: ['tab'],
    data: function () {
        return {
            showTime: false
        }
    },
    computed: {
        l_title: function () {
            var title = '';
            if(this.tab.tab == Personal.PRIVACYPOLICY) {
                title = '隐私政策';
            }
            if(this.tab.tab == Personal.COPYRIGHT) {
                title = '版权申明';
            }
            return title;
        },
        c_title: function () {
            var _cTitle = '';
            if(this.tab.tab == Personal.TELEMEDICINE) {
                _cTitle = '瑞慈远程医疗介绍';
            }else if(this.tab.tab == Personal.FAMOUSDOCTOR) {
                _cTitle = '瑞慈名医';
            }else if (this.tab.tab == Personal.CLINICINTRO) {
                _cTitle = '瑞慈诊所介绍';
            } else if (this.tab.tab == Personal.EQUIPMENT) {
                _cTitle = '专业设备介绍';
            } else if(this.tab.tab == Personal.LUNGCANCER) {
                _cTitle = '中国肺癌防治联盟-瑞慈肺结节诊治中心';
            } else if(this.tab.tab == Personal.FATTYLIVER) {
                _cTitle = '中国医师协会脂肪肝诊治中心瑞慈分中心';
            } else if(this.tab.tab == Personal.SPORTSMEDICAL) {
                _cTitle = '瑞慈亚太骨科运动医学与康复中心';
            } else if(this.tab.tab == Personal.MIAOXIAOHUI) {
                _cTitle = '缪晓辉感染与肝病诊治专家工作室';
            }
            return _cTitle;
        },
        showRelevant: function () {
            if(this.tab.tab == Personal.LUNGCANCER ||
                this.tab.tab == Personal.FATTYLIVER ||
                this.tab.tab == Personal.SPORTSMEDICAL ||
                this.tab.tab == Personal.MIAOXIAOHUI) {
                return true;
            }else {
                return false;
            }
        },
        articlesList: function () {
            var temp = [];
            if(this.tab.tab == Personal.LUNGCANCER) {
                temp = [{name: '耶鲁大学免疫治疗肺癌的新进展', url: ''},
                    {name: '肺癌免疫治疗的时代究竟是否到来', url: ''},
                    {name: '肺癌如何分类', url: ''}];
            } else if(this.tab.tab == Personal.FATTYLIVER) {
                temp = [{name: '脂肪肝怎么办？', url: ''},
                    {name: '脂肪肝十大危害', url: ''}];
            }
            return temp;
        },
        doctorList: function () {
            var temp = [];
            if(this.tab.tab == Personal.LUNGCANCER) {
                temp = [{name: '白春学 - 主任', url: 'expert-detail.html'}];
            }
            return temp;
        }
    },
    template: '<div class="graphic-frame" :style="tab.style">' +
        '<div class="title-center" v-if="tab.type">' +
            '<p class="name">{{c_title}}</p>' +
            '<p class="date" v-if="showTime">2015/8/10 13:23</p>' +
        '</div>' +
        '<div class="title-left" v-else>' +
            '<p>{{l_title}}</p>' +
        '</div>' +
        '<div class="gfc-content">' +
            '<div class="share" v-if="tab.showShare">分享到：</div>' +
            '<ul>' +
                '<li v-for="item in tab.list">' +
                    '<p class="word" v-if="item.type==1">{{item.name}}</p>' +
                    '<div class="pic" v-if="item.type==2">' +
                        '<img :src="item.name">' +
                    '</div>' +
                '</li>' +
            '</ul>' +
            '<div class="relevant-articles" v-if="showRelevant">' +
                '<p class="title">相关文章</p>' +
                '<ul class="c-relevant-content">' +
                    '<li v-for="rt in articlesList"><a :href="rt.url">{{rt.name}}</a></li>' +
                '</ul>' +
            '</div>' +
            '<div class="relevant-doctor" v-if="showRelevant">' +
                '<p class="title">相关医生</p>' +
                '<ul class="c-relevant-content">' +
                    '<li v-for="dl in doctorList"><a :href="dl.url">{{dl.name}}</a></li>' +
                '</ul>' +
            '</div>' +
        '</div>'+
    '</div>'
});